var data = [
    // { "ID": "Plan01", "Plan_Work": "2020年9月21日办公设备采购合同", "Creater": "张丹", "CreateDate": "2021-09-09 09:00" },
    // { "ID": "Plan02", "Plan_Work": "2020年9月21日办公设备采购合同", "Creater": "张丹", "CreateDate": "2021-09-09 09:00" },
    // { "ID": "Plan03", "Plan_Work": "2020年9月21日办公设备采购合同", "Creater": "张丹", "CreateDate": "2021-09-09 09:00" },
    // { "ID": "Plan04", "Plan_Work": "2020年9月21日办公设备采购合同", "Creater": "张丹", "CreateDate": "2021-09-09 09:00" },
    // { "ID": "Plan05", "Plan_Work": "2020年9月21日办公设备采购合同", "Creater": "张丹", "CreateDate": "2021-09-09 09:00" }
];


// 用户ID
let id = getUrlParam("id");
$(function () {
    GetUserRole();
});
//获取用户权限
function GetUserRole() {
    // let thisdata = [];
    // thisdata.push(InitRole(id));
    let USERdata = InitRole(id);
    if (USERdata != null) {
        InitData();

    }
    else OpenErrmsg("../../web/errhtml/404.html");
}
let path = getPath();
function InitData() {
    // $('#dg_WorkPlanList').datagrid({
    //     data: data
    // });
    let url = path+'/ls172/ls172-workorder/getBacklogList'
    var params = {
        "data": '',
        "endTime": '',
        "pageNum": 1,
        "pageSize": 15,
        "startTime": ''
    }
    console.log(params);
    $.ajax({
        url: url,
        type: "post",
        async:false,
        dataType: "json",
        headers: {
            Accept: "application/json",
            "Content-Type": "application/json"
        },
        data: JSON.stringify(params),

        success: function (data) {
            data = data.data.records
            $('#dg_WorkPlanList').datagrid({
                data: data,
            });
        },
        error: function (data) {
            console.log("code", data);
        }
    });
}

function formaterPlanWork(value, row) {
    let str = ' <label style="color:#589BD8;margin: 20px;">' + row.description + '</label><br />';
    str += ' <label style="padding:0px;margin: 20px;">发起人&nbsp;&nbsp;   ' + row.reportedby + '</label>';
    str += ' <label style="padding:0px;margin: 20px;">发起时间&nbsp;&nbsp;    ' + row.reportdate + '</label>';
    return str;
}
function formaterIndex(value, row, index) {
    return '<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;">' + (parseInt(index) + 1) + '</a>';
}
function formaterop(value, row) {
    let val ='<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;"  onclick="openmaxioWin()">处理</a>';
    return val;
}
function openmaxioWin(){
    let windowObjectReference = window.open();
    windowObjectReference.location.href = "_blank.html";
}